local slmsg = fk.CreateSkill {
  name = "slmsg",
}
Fk:loadTranslationTable{
    ["slmsg"] = "圣灵魔闪光",
    [":slmsg"] = "出牌阶段限一次,你可以视为使用一张杀，此杀造成的伤害为x(x为你的体力上限)",
    ["#slmsg-choose"] = "圣灵魔闪光：你可以视为使用无视距离的【杀】",
    ["$slmsg1"] = "圣灵魔闪光",
    ["$slmsg2"] = "下地狱吧"
}




slmsg:addEffect(fk.EventPhaseStart, {
  anim_type = "switch",
  mute = true;
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(slmsg.name) and player.phase == Player.Start and
      table.find(player.room:getOtherPlayers(player, false), function (p)
        return player:canUseTo(Fk:cloneCard("slash"), p, {bypass_distances = true, bypass_times = true})
      end)
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    local slash = Fk:cloneCard("slash")
    local max_num = slash.skill:getMaxTargetNum(player, slash)
    local targets = table.filter(room:getOtherPlayers(player, false), function (p)
      return player:canUseTo(slash, p, {bypass_distances = true, bypass_times = true})
    end)
    local tos = room:askToChoosePlayers(player, {
      min_num = 1,
      max_num = max_num,
      targets = targets,
      skill_name = slmsg.name,
      prompt = "#slmsg-choose",
      cancelable = true,
    })
    if #tos > 0 then
      event:setCostData(self, {tos = tos})
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local targets = event:getCostData(self).tos
    room:sortByAction(targets)
    room:useVirtualCard("slash", nil, player, targets, slmsg.name, true)
    
  end,
})
slmsg:addEffect(fk.TargetSpecified, {
  anim_type = "offensive",
  can_trigger = function(self, event, target, player, data)
    return
      target == player and
      data.card.trueName == "slash" and
      player:hasSkill(slmsg.name)
  end,
  on_cost = Util.TrueFunc,
  on_use = function(self, event, target, player, data)
    data.to:addQinggangTag(data)
  end,
})
slmsg:addEffect(fk.DamageCaused, {
  anim_type = "offensive",
  can_trigger = function(self, event, target, player, data)
    return data.from == player and player:hasSkill(slmsg.name) and
      data.card and data.card.trueName == "slash"
  end,
  on_cost = Util.TrueFunc,
  on_use = function(self, event, target, player, data)
    data:changeDamage(player.maxHp-1)
  end,
})





return slmsg
